
#ifndef _QUEUE_THREAD_H_INCLUDE_
#define _QUEUE_THREAD_H_INCLUDE_

///////////////////////////////////////////////////////////////////////////////////////////////////////////
//
#include <Windows.h>
#include <list>
using namespace std;

///////////////////////////////////////////////////////////////////////////////////////////////////////////
//
typedef unsigned long long ULONGLONG;

class QueueParam
{
public:
	ULONGLONG	m_ullParam_1;
	ULONGLONG	m_ullParam_2;
	ULONGLONG	m_ullParam_3;
};

///////////////////////////////////////////////////////////////////////////////////////////////////////////
//
class QueueThread
{
public:
	QueueThread();
	virtual ~QueueThread();

private:
	static UINT WorkerThread(void *lpParam);

public:
	BOOL StartThread();
	void EndThread();

private:
	UINT Run();
	DWORD CheckEndRequest();

protected:
	int AddQueueMessage(ULONGLONG ullParam_1 = 0, ULONGLONG ullParam_2 = 0, ULONGLONG ullParam_3 = 0);

private:	
	int GetQueueMessage(QueueParam& queueParam);
	void ProcessQueue(QueueParam queueParam);

protected:
	void ClearQueue();
	int GetQueueSize();

protected:
	virtual void HandleMessage(	ULONGLONG ullParam_1, ULONGLONG ullParam_2, ULONGLONG ullParam_3);

private:
	HANDLE					m_lpThread;
	HANDLE					m_hEndEvent;
	HANDLE					m_hQueue;
	QueueThread*			m_lpQueueThread;
	CRITICAL_SECTION		m_CriticalSection;
	list<QueueParam*>		m_Queue;
};

#endif